home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 22
/
freelog 22.iso
/
Prog
/
Djgpp
/
GPC2952B.ZIP
/
info
/
gpc.i16
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
GNU Info File
|
2001-02-09
|
49.1 KB
|
2,581 lines
This is gpc.info, produced by makeinfo version 4.0 from gpc.texi.
INFO-DIR-SECTION GNU programming tools
START-INFO-DIR-ENTRY
* GPC: (gpc). The GNU Pascal Compiler.
END-INFO-DIR-ENTRY
INFO-DIR-SECTION Individual utilities
START-INFO-DIR-ENTRY
* GPC: (gpc)Invoking GPC. The GNU Pascal Compiler.
END-INFO-DIR-ENTRY
This file documents the GNU Pascal Compiler.
Copyright (C) 1988, 1996-2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled "GNU General Public License", "The GNU
Project", "The GNU Manifesto" and "Funding for Free Software" are
included exactly as in the original, and provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "GNU General Public
License", "The GNU Project", "The GNU Manifesto" and "Funding for Free
Software" and this permission notice, may be included in translations
approved by the Free Software Foundation instead of in the original
English.
File: gpc.info, Node: ShortCard, Next: ShortInt, Prev: ShortBool, Up: Reference
ShortCard
=========
Synopsis
--------
type
ShortCard = Cardinal (BitSizeOf (ShortInt));
Description
-----------
`ShortCard' is an unsigned integer type which is not larger than
`Cardinal'. On most platforms it is 16 bits wide and thus has a range
of `0..65535'.
`ShortCard' in GNU Pascal is compatible to `short unsigned int' in
GNU C.
There are lots of other integer types in GPC, see *Note Integer
Types::.
Conforming to
-------------
`ShortCard' is a GNU Pascal extension.
Example
-------
program ShortCardDemo;
var
a: ShortCard;
begin
a := 42;
WriteLn (a)
end.
See also
--------
*Note Integer Types::, *Note Subrange Types::.
File: gpc.info, Node: ShortInt, Next: ShortReal, Prev: ShortCard, Up: Reference
ShortInt
========
Synopsis
--------
type
ShortInt { built-in type }
Description
-----------
`ShortInt' is a signed integer type which is not larger than
`Integer'. On most platforms it is 16 bits wide and thus has a range
of `-32768..32767'.
`ShortInt' in GNU Pascal is compatible to `short int' in GNU C.
There are lots of other integer types in GPC, see *Note Integer
Types::.
Conforming to
-------------
`ShortInt' is a Borland Pascal extension. In Borland Pascal,
`ShortInt' is an 8-bit signed integer type (`ByteInt' in GNU Pascal).
Example
-------
program ShortIntDemo;
var
a: ShortInt;
begin
a := 42;
WriteLn (a)
end.
See also
--------
*Note Integer Types::, *Note Subrange Types::.
File: gpc.info, Node: ShortReal, Next: ShortWord, Prev: ShortInt, Up: Reference
ShortReal
=========
(Under construction.)
Synopsis
--------
type
ShortReal { built-in type }
Description
-----------
Conforming to
-------------
Example
-------
program ShortRealDemo;
var
a: ShortReal;
begin
a := 42;
WriteLn (a)
end.
See also
--------
File: gpc.info, Node: ShortWord, Next: shr, Prev: ShortReal, Up: Reference
ShortWord
=========
Synopsis
--------
type
ShortWord = ShortCard;
Description
-----------
`ShortWord' is an unsigned integer type which is not larger than
`Word'. On most platforms it is 16 bits wide and thus has a range of
of `0..65535'. It is the same as *Note ShortCard::.
`ShortWord' in GNU Pascal is compatible to `short unsigned int' in
GNU C.
There are lots of other integer types in GPC, see *Note Integer
Types::.
Conforming to
-------------
`ShortWord' is a GNU Pascal extension.
`ShortWord' in GNU Pascal essentially corresponds to `Word' in
Borland Pascal and Delphi where it is a 16-bit unsigned integer type.
Example
-------
program ShortWordDemo;
var
a: ShortWord;
begin
a := 42;
WriteLn (a)
end.
See also
--------
*Note Integer Types::, *Note Subrange Types::.
File: gpc.info, Node: shr, Next: Sin, Prev: ShortWord, Up: Reference
shr
===
Synopsis
--------
operator shr (operand1, operand2: INTEGER TYPE) = Result: INTEGER TYPE;
or
procedure shr (var operand1: INTEGER TYPE; operand2: INTEGER TYPE);
Description
-----------
In GNU Pascal, `shr' has two built-in meanings:
1. Bitwise shift right of an integer-type expression by another
integer value. The result is of the type of the first operand.
2. Use as a "procedure": `operand1' is shifted right by `operand2';
the result is stored in `operand1'.
Conforming to
-------------
`shr' is a Borland Pascal extension.
Unlike the Borland compilers, GNU Pascal cares about the signedness
of the first operand: If a signed integer with a negative value is
shifted right, "one" bits are filled in from the left.
Use of `shr' as a "procedure" is a GNU Pascal extension.
Example
-------
program ShrDemo;
var
a: Integer;
begin
a := 1024 shr 4; { yields 64 }
a := -127 shr 4; { yields -8 }
shr (a, 2) { same as `a := a shr 2' }
end.
See also
--------
*Note shl::, *Note Operators::.
File: gpc.info, Node: Sin, Next: Single, Prev: shr, Up: Reference
Sin
===
Synopsis
--------
function Sin (x: Real): Real;
or
function Sin (z: Complex): Complex;
Description
-----------
`Sin' returns the sine of the argument. The result is in the range
`-1 <= Sin (x) <= 1' for real arguments.
Conforming to
-------------
The function `Sin' is defined in ISO-7185 Standard Pascal; its
application to complex values is defined in ISO-10206 Extended Pascal.
Example
-------
program SinDemo;
begin
WriteLn (Sin (SqRt (2) / 2) : 0 : 5)
{ yields 0.5 since Sin (SqRt (2) /2) = 0.5 }
end.
See also
--------
*Note ArcTan::, *Note Cos::, *Note Ln::, *Note Arg::.
File: gpc.info, Node: Single, Next: SizeOf, Prev: Sin, Up: Reference
Single
======
(Under construction.)
Synopsis
--------
type
Single = ShortReal;
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: SizeOf, Next: SizeType, Prev: Single, Up: Reference
SizeOf
======
Synopsis
--------
function SizeOf (var x): SizeType;
Description
-----------
Returns the size of a type or variable in bytes.
Conforming to
-------------
`SizeOf' is a UCSD Pascal extension.
Example
-------
program SizeOfDemo;
var
a: Integer;
b: array [1 .. 8] of Char;
begin
WriteLn (SizeOf (a)); { Size of an `Integer'; often 4 bytes. }
WriteLn (SizeOf (b)) { Size of eight `Char's; usually 8 bytes. }
end.
See also
--------
*Note BitSizeOf::, *Note AlignOf::, *Note TypeOf::.
File: gpc.info, Node: SizeType, Next: SmallInt, Prev: SizeOf, Up: Reference
SizeType
========
(Under construction.)
Synopsis
--------
type
SizeType { built-in type }
Description
-----------
Conforming to
-------------
Example
-------
program SizeTypeDemo;
var
a: array [1 .. 10] of Integer;
Size: SizeType;
begin
Size := SizeOf (a);
WriteLn (Size)
end.
See also
--------
File: gpc.info, Node: SmallInt, Next: Sqr, Prev: SizeType, Up: Reference
SmallInt
========
Synopsis
--------
type
SmallInt = ShortInt;
Description
-----------
`SmallInt' is a signed integer type which is not larger than
`Integer'. On most platforms it is 16 bits wide and thus has a range of
`-32768..32767'. It is the same as `ShortInt' (see *Note ShortInt::).
There are lots of other integer types in GPC, see *Note Integer
Types::.
Conforming to
-------------
`SmallInt' is a Delphi 2.0 extension.
Example
-------
program SmallIntDemo;
var
a: SmallInt;
begin
a := 42;
WriteLn (a)
end.
See also
--------
*Note ShortInt::, *Note Integer Types::, *Note Subrange Types::.
File: gpc.info, Node: Sqr, Next: SqRt, Prev: SmallInt, Up: Reference
Sqr
===
Synopsis
--------
function Sqr (i: INTEGER TYPE): INTEGER TYPE;
or
function Sqr (x: REAL TYPE): REAL TYPE;
or
function Sqr (z: COMPLEX TYPE): COMPLEX TYPE;
Description
-----------
Returns the square of the argument:
function Sqr (x: SOME TYPE): SOME TYPE;
begin
Sqr := x * x { or: x pow 2 }
end;
Conforming to
-------------
The function `Sqr' is defined in ISO-7185 Standard Pascal; its
application to complex values is defined in ISO-10206 Extended Pascal.
Example
-------
program SqrDemo;
var
i: Complex;
begin
i := Cmplx (0, 1);
WriteLn (Re (Sqr (i)) : 0 : 3) { yields -1.000 }
end.
See also
--------
*Note pow::, *Note SqRt::, *Note Abs::, *Note Operators::.
File: gpc.info, Node: SqRt, Next: StandardError, Prev: Sqr, Up: Reference
SqRt
====
Synopsis
--------
function SqRt (x: REAL TYPE): REAL TYPE;
or
function SqRt (z: COMPLEX TYPE): COMPLEX TYPE;
Description
-----------
Returns the positive square root of the argument.
For real arguments, it is an error if the argument is negative.
For complex arguments, `SqRt' returns the principal value of the
root of the argument, i.e. the root with positive real part, or, if the
real part is zero, that one with positive imaginary part.
Conforming to
-------------
The function `SqRt' is defined in ISO-7185 Standard Pascal; its
application to complex values is defined in ISO-10206 Extended Pascal.
Example
-------
program SqRtDemo;
var
m1: Complex;
begin
m1 := Cmplx (-1, 0); { -1 }
WriteLn (Re (SqRt (m1)) : 6 : 3, Im (SqRt (m1)) : 6 : 3);
{ yields 1.000 -1.000, i.e. the imaginary unit, i }
end.
See also
--------
*Note pow::, *Note Sqr::, *Note Operators::.
File: gpc.info, Node: StandardError, Next: StandardInput, Prev: SqRt, Up: Reference
StandardError
=============
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: StandardInput, Next: StandardOutput, Prev: StandardError, Up: Reference
StandardInput
=============
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: StandardOutput, Next: static, Prev: StandardInput, Up: Reference
StandardOutput
==============
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: static, Next: StdErr, Prev: StandardOutput, Up: Reference
static
======
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: StdErr, Next: Str, Prev: static, Up: Reference
StdErr
======
Synopsis
--------
var
StdErr: Text;
Description
-----------
The `StdErr' variable is connected to the standard error file
handle. To report errors, you should prefer `WriteLn (StdErr,
'everything wrong')' over `WriteLn ('everything wrong')'.
Conforming to
-------------
`StdErr' is a GNU Pascal extension.
Example
-------
program StdErrDemo;
var
Denominator: Integer;
begin
ReadLn (Denominator);
if Denominator = 0 then
WriteLn (StdErr, ParamStr (0), ': division by zero')
else
WriteLn ('1 / ', Denominator, ' = ', 1 / Denominator)
end.
See also
--------
*Note StandardError::, *Note Output::, *Note Input::.
File: gpc.info, Node: Str, Next: String, Prev: StdErr, Up: Reference
Str
===
(Under construction.)
Synopsis
--------
procedure Str (x: INTEGER OR REAL; var Dest: String);
or
procedure Str (x: INTEGER OR REAL : FIELD WIDTH; var Dest: String);
or
procedure Str (x: Real : FIELD WIDTH : PRECISION; var Dest: String);
or
procedure Str (REPEATED CONSTRUCTS AS DESCRIBED ABOVE; var Dest: String);
Description
-----------
Conforming to
-------------
`Str' is a UCSD Pascal extension, generalized by Borland Pascal.
The possibility to handle more than one variable with one call to `Str'
is a GNU Pascal extension.
ISO-10206 Extended Pascal defines `WriteStr' instead of `Str'.
Example
-------
See also
--------
*Note WriteStr::.
File: gpc.info, Node: String, Next: String2CString, Prev: Str, Up: Reference
String
======
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: String2CString, Next: SubStr, Prev: String, Up: Reference
String2CString
==============
(Under construction.)
Synopsis
--------
function String2CString (const S: String): CString;
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: SubStr, Next: Succ, Prev: String2CString, Up: Reference
SubStr
======
Synopsis
--------
function SubStr (S: String; FirstChar: Integer): String;
or
function SubStr (S: String; FirstChar, Count: Integer): String;
Description
-----------
`SubStr' returns a sub-string of S starting with the character at
position FIRSTCHAR. If COUNT is given, such many characters will be
copied into the sub-string. If COUNT is omitted, the sub-string will
will range to the end of S.
If `Count' is too large for the sub-string to fit in S or if
`FirstChar' exceeds the length of S, `SubStr' triggers a runtime error.
(For a function returning the empty string instead, see *Note Copy::.)
Conforming to
-------------
`SubStr' is a ISO 10206 Extended Pascal extension.
Example
-------
program SubStrDemo;
var
S: String (42);
begin
S := 'Hello';
WriteLn (SubStr (S, 2, 3)); { yields "ell" }
WriteLn (SubStr (S, 3)); { yields "llo" }
WriteLn (SubStr (S, 4, 7)); { yields a runtime error }
WriteLn (SubStr (S, 42)); { yields a runtime error }
end.
See also
--------
*Note Copy::, String slice access.
File: gpc.info, Node: Succ, Next: Text, Prev: SubStr, Up: Reference
Succ
====
Synopsis
--------
function Succ (i: ORDINAL TYPE): ORDINAL TYPE;
or
function Succ (i: ORDINAL TYPE; j: Integer): ORDINAL TYPE;
or, with extended syntax (`--extended-syntax' or `{$X+}'),
function Succ (p: POINTER TYPE): POINTER TYPE;
or
function Succ (p: POINTER TYPE; j: Integer): POINTER TYPE;
Description
-----------
Returns the successor of the ORDINAL TYPE value `i', or, if the
second argument `j' is given, its `j'th successor. For integer values
`i', this is `i + 1' (or `i + j'). (No, `Succ' does _not_ work faster
than plain addition. Both are optimized to a single machine
instruction or even expanded by the compiler, if possible.)
If extended syntax is on, the argument may also be a pointer value.
In this case, the address is incremented by the size of the variable
pointed to, or, if `j' is given, by `j' times the size of the variable
pointed to. If `p' points to an element of an array, the returned
pointer will point to the (`j'th) next element of the array.
Conforming to
-------------
The `Succ' function is defined in ISO-7185 Standard Pascal. The
optional second parameter is defined in ISO-10206 Extended Pascal.
Application of `Succ' to pointers is defined in Borland Pascal. The
combination of the second argument with application to pointers is a
GNU extension.
Example
-------
program SuccDemo;
type
Metasyntactical = (foo, bar, baz);
var
m: Metasyntactical;
c: Char;
a: array [1 .. 7] of Integer;
p: ^Integer;
begin
m := Succ (foo); { bar }
c := Succ ('A', 4); { 'E' }
a [1] := 42;
a [2] := Succ (a [1]); { 43 }
a [5] := Succ (a [2], 7); { 50 }
{$X+}
p := @a [1];
p := Succ (p); { points to `a [2]' now }
p := Succ (p, 3); { points to `a [5]' now }
end.
See also
--------
*Note Pred::, *Note Inc::, *Note Pointer Arithmetics::.
File: gpc.info, Node: Text, Next: TextWritable, Prev: Succ, Up: Reference
Text
====
(Under construction.)
Synopsis
--------
type
Text { built-in type }
Description
-----------
Conforming to
-------------
Example
-------
program TextDemo;
var
t: Text;
begin
Rewrite (t, 'hello.txt');
WriteLn (t, 'Hello, world!')
end.
See also
--------
File: gpc.info, Node: TextWritable, Next: then, Prev: Text, Up: Reference
TextWritable
============
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: then, Next: Time, Prev: TextWritable, Up: Reference
then
====
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
program ThenDemo;
var
i: Integer;
begin
Write ('Enter a number: ');
ReadLn (i);
if i > 42 then
WriteLn ('The number is greater than 42')
end.
See also
--------
File: gpc.info, Node: Time, Next: TimeStamp, Prev: then, Up: Reference
Time
====
(Under construction.)
Synopsis
--------
function Time (T: TimeStamp): packed array [1 .. TIME LENGTH] of Char;
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: TimeStamp, Next: to, Prev: Time, Up: Reference
TimeStamp
=========
(Under construction.)
Synopsis
--------
type
TimeStamp = {@@packed} record
DateValid,
TimeValid : Boolean;
Year : Integer;
Month : 1 .. 12;
Day : 1 .. 31;
DayOfWeek : 0 .. 6; { 0 means Sunday }
Hour : 0 .. 23;
Minute : 0 .. 59;
Second : 0 .. 61; { to allow for leap seconds }
MicroSecond : 0 .. 999999
end;
(@@ Currently, in GPC, TimeStamp is not actually packed.)
All fields except DayOfWeek and MicroSecond are required by Extended
Pascal.
@@ `TimeStamp' may be later extended in GPC to contain the following
additional fields:
Dst_used : Boolean; { If daylight savings are used }
TimeZone : Integer; { Positive if west, in minutes }
TimerValid : Boolean; { Is the following timer valid }
us_Timer : Integer; { A microsecond timer that is a 32 bit
modulus of the timer returned by the system. }
Fields `Dst_used, TimeZone' and `DayOfWeek' will be valid when
`DateValid' is `True'. Field `us_Timer' will be valid when `TimerValid'
is `True'.
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: to, Next: to begin do, Prev: TimeStamp, Up: Reference
to
==
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: to begin do, Next: to end do, Prev: to, Up: Reference
to begin do
===========
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: to end do, Next: Trim, Prev: to begin do, Up: Reference
to end do
=========
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: Trim, Next: True, Prev: to end do, Up: Reference
Trim
====
(Under construction.)
Synopsis
--------
function Trim (S: String): String;
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: True, Next: Trunc, Prev: Trim, Up: Reference
True
====
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: Trunc, Next: Truncate, Prev: True, Up: Reference
Trunc
=====
Synopsis
--------
function Trunc (x: Real): Integer;
Description
-----------
`Trunc' converts `x' to the next integer below its argument (i.e.
truncates the numbers after the point).
Conforming to
-------------
`Trunc' is defined in ISO-7185 Standard Pascal and supported by all
known Pascal variants.
Example
-------
program TruncDemo;
var
Foo: Real;
begin
Foo := 9.876;
WriteLn (Trunc (Foo)) { Prints 9 }
end.
See also
--------
*Note Round::.
File: gpc.info, Node: Truncate, Next: type, Prev: Trunc, Up: Reference
Truncate
========
(Under construction.)
Synopsis
--------
procedure Truncate (var F: ANY FILE);
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: type, Next: type of, Prev: Truncate, Up: Reference
type
====
Synopsis
--------
As a type declaration:
type
TYPE INDENTIFIER = TYPE DEFINITION;
or with initialization:
type
TYPE INDENTIFIER = TYPE DEFINITION value CONSTANT EXPRESSION;
Description
-----------
The reserved word `type' starts the declaration of a TYPE IDENTIFIER
which is defined by TYPE DEFINITION. For further description see *Note
Type Declaration::, *Note Type Declaration::, *Note Type Definition::,
*Note Data Types::.
Conforming to
-------------
`type' is defined in ISO-7185 Standard Pascal and supported by all
known Pascal variants. Initializers are an ISO-10206 Extended Pascal
extension.
Example
-------
program TypeDemo;
type
{ This side is the } { That side is the }
{ type declaration } { type definition }
{ array type }
ArrayType = array [0 .. 9] of Integer;
{ record type }
RecordType = record
bar: Integer
end;
{ subrange type }
SubrangeType = -123 .. 456;
{ enumeration type }
EnumeratedType = (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
{ set type }
CharSetType = set of Char;
{ object type }
ObjectType = object
constructor Init;
procedure Method;
destructor Done
end;
{ pointer type to another type identifier }
PArrayType = ^ArrayType;
{ an alias name for another type identifier }
IntegerType = Integer;
{ an integer which is initialized by 123 }
InitializedInt = Integer value 123;
{ a schema with discriminants x and y of type Integer }
SchemaType (x, y: Integer) = array [x .. y] of Integer;
begin
end.
See also
--------
*Note Type Declaration::, *Note Type Definition::, *Note Data
Types::, *Note Variable Declaration::, *Note array::, *Note record::,
*Note object::, *Note set::, *Note Pointer::, *Note value::.
File: gpc.info, Node: type of, Next: TypeOf, Prev: type, Up: Reference
type of
=======
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: TypeOf, Next: UnBind, Prev: type of, Up: Reference
TypeOf
======
Synopsis
--------
function TypeOf (var x): Pointer;
Description
-----------
Returns a pointer to the VMT of an _object_ type or variable. This
pointer can be used to identify the type of an object.
Conforming to
-------------
ISO Pascal does not define `TypeOf', Borland Pascal does.
Example
-------
program TypeOfDemo;
type
FooPtr = ^Foo;
BarPtr = ^Bar;
Foo = object { Has a VMT, though it doesn't }
x: Integer; { contain virtual methods. }
constructor Init;
end;
Bar = object (Foo)
y: Integer;
end;
constructor Foo.Init;
begin
end;
var
MyFoo: FooPtr;
begin
MyFoo := New (BarPtr, Init);
if TypeOf (MyFoo^) = TypeOf (bar) then { True }
WriteLn ('OK')
end.
See also
--------
*Note BitSizeOf::, *Note AlignOf::, *Note TypeOf::, *Note SetType::,
*Note OOP::.
File: gpc.info, Node: UnBind, Next: unit, Prev: TypeOf, Up: Reference
UnBind
======
(Under construction.)
Synopsis
--------
procedure UnBind (var F: ANY FILE);
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: unit, Next: Unpack, Prev: UnBind, Up: Reference
unit
====
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: Unpack, Next: until, Prev: unit, Up: Reference
Unpack
======
(Under construction.)
Synopsis
--------
procedure Unpack (Source: PACKED ARRAY;
var Dest: UNPACKED ARRAY;
FirstElement: INDEX TYPE);
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: until, Next: UpCase, Prev: Unpack, Up: Reference
until
=====
(Under construction.)
Synopsis
--------
Description
-----------
`until' is part of the `repeat ... until' loop statement.
Conforming to
-------------
Example
-------
See also
--------
*Note repeat::, *Note while::, *Note for::.
File: gpc.info, Node: UpCase, Next: Update, Prev: until, Up: Reference
UpCase
======
(Under construction.)
Synopsis
--------
function UpCase (Ch: Char): Char;
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: Update, Next: uses, Prev: UpCase, Up: Reference
Update
======
(Under construction.)
Synopsis
--------
procedure Update (var F: ANY FILE);
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: uses, Next: Val, Prev: Update, Up: Reference
uses
====
Synopsis
--------
In a program:
program @@fragment foo;
uses
bar1,
bar2 in 'baz.pas',
bar3;
[...]
In a unit:
unit @@fragment Bar3;
interface
uses
bar1,
bar2 in 'baz.pas';
[...]
implementation
uses
bar3,
bar4 in 'qux.pas';
[...]
Description
-----------
The reserved word `uses' in the _import part_ of a program or unit
makes the program or unit import an interface.
The keyword `in' tells GPC to look for the `unit' in the specified
file; otherwise the file name is derived from the name of the interface
by adding first `.p', then `.pas'.
There must be at most one import part in a program.
In a unit, there can be one import part in the interface part and
one in the implementation part.
The imported interface needn't be a UCSD/Borland Pascal unit, it may
be an interface exported by an Extended Pascal module as well.
Conforming to
-------------
ISO Pascal does not define `uses' and units at all. UCSD and Borland
Pascal do, but without the `in' extension. Delphi supports `uses' like
described above.
Example
-------
See also
--------
*Note unit::, *Note module::, *Note import::.
File: gpc.info, Node: Val, Next: value, Prev: uses, Up: Reference
Val
===
(Under construction.)
Synopsis
--------
procedure Val (const Source: String; var x: INTEGER OR REAL);
or
procedure Val (const Source: String; var x: INTEGER OR REAL;
var ErrorCode: Integer);
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: value, Next: var, Prev: Val, Up: Reference
value
=====
Synopsis
--------
Description
-----------
The reserved word `value' is part of a type or var declaration. It
can be replaced by `:=' or `='.
Conforming to
-------------
`value' is an ISO-10206 Extended Pascal extension. `:=' in this
context is a VAX Pascal extension, and `=' is a Borland Delphi
extension.
Example
-------
See also
--------
*Note var::, *Note type::, *Note Variable Declaration::, *Note Type
Declaration::.
File: gpc.info, Node: var, Next: view, Prev: value, Up: Reference
var
===
Synopsis
--------
As part of a variable declaration part:
var VARIABLE IDENTIFIER: TYPE IDENTIFIER;
or
var VARIABLE IDENTIFIER: TYPE DEFINITION;
and with initializing value:
var VARIABLE IDENTIFIER: TYPE IDENTIFIER value CONSTANT EXPRESSION;
or
var VARIABLE IDENTIFIER: TYPE DEFINITION value CONSTANT EXPRESSION;
As part of a parameter list:
var VAR PARAMETER;
or with type declaration
var VAR PARAMETER: TYPE IDENTIFIER;
or with forced passing by reference:
protected var VAR PARAMETER;
or with type declaration
protected var VAR PARAMETER: TYPE IDENTIFIER;
Description
-----------
In a declaration part: The reserved word `var' declares a VARIABLE
IDENTIFIER whose type is of TYPE IDENTIFIER or which is defined by TYPE
DEFINITION. For further description see *Note Variable Declaration::,
*Note Type Declaration::, *Note Type Definition::, *Note Data Types::.
In a parameter list: see *Note Subroutine Parameter List
Declaration::.
Conforming to
-------------
`var' is defined in ISO-7185 Standard Pascal and supported by all
known Pascal variants. Untyped `var' parameters in parameter lists are
a UCSD Pascal extension.
Example
-------
program VarDemo;
type
FooType = Integer;
var
Bar: FooType;
ArrayFoo: array [0 .. 9] of Integer; { array var definition }
FecordFoo: record { record var definition }
bar : Integer
end;
CharsetFoo: set of Char; { set var }
SubrangeFoo: -123 .. 456; { subrange var }
EnumeratedFoo: (Mon, Tue, Wed, Thu, Fri, Sat, Sun); {enumerated var }
PointerBar: ^FooType; { pointer var }
procedure ReadFoo (var foo: FooType);
begin
ReadLn (foo)
end;
begin
end.
See also
--------
*Note type::, *Note array::, *Note record::, *Note set::, *Note
Subrange Types::, *Note Pointer::, *Note protected::.
File: gpc.info, Node: view, Next: virtual, Prev: var, Up: Reference
view
====
Not yet implemented.
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: virtual, Next: Void, Prev: view, Up: Reference
virtual
=======
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: Void, Next: volatile, Prev: virtual, Up: Reference
Void
====
(Under construction.)
Synopsis
--------
type
Void { built-in type }
Description
-----------
Conforming to
-------------
Example
-------
program VoidDemo;
procedure p (var x : Void);
begin
end;
var
i: Integer;
s: String (42);
begin
p (i);
p (s)
end.
See also
--------
File: gpc.info, Node: volatile, Next: while, Prev: Void, Up: Reference
volatile
========
(Under construction.)
Synopsis
--------
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: while, Next: with, Prev: volatile, Up: Reference
while
=====
Synopsis
--------
while BOOLEAN EXPRESSION do
STATEMENT
Description
-----------
The `while' statement declares a loop. For further description see
*Note while Statement::.
Conforming to
-------------
`while' is defined in ISO-7185 Standard Pascal and supported by all
known Pascal variants.
Example
-------
program WhileDemo;
var
Foo, Bar: Integer;
begin
WriteLn ('Enter an descending series of integer numbers.');
WriteLn ('Terminate by breaking this rule.');
WriteLn ('Enter start number: ');
Bar := MaxInt;
ReadLn (Foo);
while Foo < Bar do
begin
Bar := Foo;
ReadLn (Foo)
end;
WriteLn ('The last number of your series was: ', Bar)
end.
See also
--------
*Note repeat Statement::, *Note for Statement::
File: gpc.info, Node: with, Next: Word, Prev: while, Up: Reference
with
====
(Under construction.)
Synopsis
--------
Description
-----------
_Note_: `with' statement overwrites program namespace.
Conforming to
-------------
Example
-------
...
{ Note bar is overwritten by foo.bar } ...
See also
--------
File: gpc.info, Node: Word, Next: WordBool, Prev: with, Up: Reference
Word
====
Synopsis
--------
type
Word = Cardinal;
or
type
Word (n) = Cardinal (n);
Description
-----------
`Word' is the "natural" unsigned integer type in GNU Pascal. On
most platforms it is 32 bits wide and thus has a range of
`0..4294967295'. It is the same as *Note Cardinal::, introduced for
compatibility with other Pascal compilers.
As an extension, GPC allows to use `Word' as a pseudo-schema to
produce types with a specified size in bits; for example
type
Word16 = Cardinal (16);
defines an unsigned integer type with 16 bits. The same mechanism
works for `Cardinal' and `Integer', too.
`Word' in GNU Pascal is compatible to `unsigned int' in GNU C.
There are lots of other integer types in GPC, see *Note Integer
Types::.
Conforming to
-------------
ISO Pascal does not define `Cardinal'. (However see *Note Subrange
Types::.)
The `Word' type appears in Borland Pascal and Delphi, too, where it
is a 16-bit unsigned integer type.
Example
-------
program WordDemo;
var
a: Word;
begin
a := 42;
WriteLn (a)
end.
See also
--------
*Note Integer Types::, *Note Subrange Types::.
File: gpc.info, Node: WordBool, Next: Write, Prev: Word, Up: Reference
WordBool
========
(Under construction.)
Synopsis
--------
type
WordBool = Boolean (BitSizeOf (Word));
Description
-----------
Conforming to
-------------
Example
-------
program WordBoolDemo;
var
a: WordBool;
begin
Word (a) := 1;
if a then WriteLn ('Ord (True) = 1')
end.
See also
--------
File: gpc.info, Node: Write, Next: WriteLn, Prev: WordBool, Up: Reference
Write
=====
(Under construction.)
Synopsis
--------
procedure Write (var F: TYPED FILE; VARIABLE);
or
procedure Write (var F: Text; VALUES AND FORMAT SPECIFICATIONS);
or
procedure Write (VALUES AND FORMAT SPECIFICATIONS);
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: WriteLn, Next: WriteStr, Prev: Write, Up: Reference
WriteLn
=======
(Under construction.)
Synopsis
--------
procedure WriteLn (var F: Text; VALUES AND FORMAT SPECIFICATIONS);
or
procedure WriteLn (VALUES AND FORMAT SPECIFICATIONS);
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: WriteStr, Next: xor, Prev: WriteLn, Up: Reference
WriteStr
========
(Under construction.)
Synopsis
--------
procedure WriteStr (var Dest: String; VALUES AND FORMAT SPECIFICATIONS);
Description
-----------
Conforming to
-------------
Example
-------
See also
--------
File: gpc.info, Node: xor, Prev: WriteStr, Up: Reference
xor
===
Synopsis
--------
operator xor (operand1, operand2: Boolean) = Result: Boolean;
or
operator xor (operand1, operand2: INTEGER TYPE) = Result: INTEGER TYPE;
or
procedure xor (var operand1: INTEGER TYPE; operand2: INTEGER TYPE);
Description
-----------
In GNU Pascal, `xor' has three built-in meanings:
1. Logical "exclusive or" between two `Boolean'-type expressions.
The result of the operation is of `Boolean' type. (Logical `foo
xor bar' in fact has the same effect as `foo <> bar'.)
2. Bitwise "exclusive or" between two integer-type expressions. The
result is of the common integer type of both expressions.
3. Use as a "procedure": `operand1' is "xor"ed bitwise with
`operand2'; the result is stored in `operand1'.
Conforming to
-------------
ISO Pascal does not define the `xor' operator; Borland Pascal and
Delphi do.
Use of `xor' as a "procedure" is a GNU extension.
Example
-------
program XorDemo;
var
a, b, c: Integer;
begin
if (a = 0) xor (b = 0) then
c := 1 { happens if either `a' or `b' is zero, }
{ but not if both are zero or both nonzero }
else if a xor b = 0 then { bitwise xor }
c := 2 { happens if a = b }
else
xor (c, a) { same as `c := c xor a' }
end.
See also
--------
*Note and::, *Note or::, *Note Operators::.
File: gpc.info, Node: Keywords, Next: Support, Prev: Reference, Up: Top
Pascal keywords and operators supported by GNU Pascal.
******************************************************
This chapter lists all keywords understood by GNU Pascal.
By default, keywords can be redefined to make it possible that every
correct ISO 7185 program can be compiled. However, you can use the
compiler dialect switches (e.g., `--extended-pascal' or
`--borland-pascal') to tell GPC that keywords of a given standard must
not be redefined.
The keywords are taken from the following standards:
* ISO 7185 Standard Pascal (SP)
* ISO 10206 Extended Pascal (EP)
* ANSI draft Object Pascal (OP)
* USCD Pascal (USCD)
* Borland Pascal 7.0 (BP)
* Borland Delphi (BD)
* Pascal-SC (PXSC, Pascal eXtensions for Scientific Calculations)
* VAX Pascal (VP)
* GNU Pascal extensions (GPC)
In GPC you are free to re-define everything that is not a reserved
word in ISO 7185 Pascal in your program or the dialect selected. E.g.,
you do not have to modify your code for GPC if you have an identifier
like `Restricted' or `Value' or some such, unless you compile with the
`--extended-pascal' option.
The following table lists all known keywords with short
descriptions. The links point to the longer descriptions in the
reference.
absolute (BP, BD, GPC) (*note absolute::)
overloaded variable declaration
abstract (OP, GPC) (*note abstract::)
abstract object type declaration (not yet implemented)
all (GPC) (*note all::)
`export' (*note export::) extension (`export foo = all')
and (any) (*note and::)
Boolean or bitwise `and' operator or part of the `and then' (*note
and then::) operator
and_then (EP, OP, GPC) (*note and_then::)
short-circuit Boolean `and' (*note and::) operator
array (any) (*note array::)
array type declaration
asm (BP, BD, GPC) (*note asm::)
GNU style inline assembler code
asmname (GPC) (*note asmname::)
linker name of routines and variables
attribute (GPC) (*note attribute::)
attributes of routines and variables
begin (any) (*note begin::)
begin of a code block, part of a `to begin do' (*note to begin
do::) module constructor
bindable (EP, OP, GPC) (*note bindable::)
external binding of files
case (any) (*note case::)
multi-branch conditional statement or variant record type
class (OP, BD, GPC) (*note class::)
OOE/Delphi style object classes (not yet implemented)
const (any) (*note const::)
constant declaration or constant parameter declaration
constructor (OP, BP, BD, GPC) (*note constructor::)
object constructor
destructor (OP, BP, BD, GPC) (*note destructor::)
object destructor
div (any) (*note div::)
integer or real division operator
do (any) (*note do::)
part of a `while' (*note while::) or `for' (*note for::) loop, a
`with' (*note with::) statement, or a `to begin do' (*note to
begin do::) or `to end do' (*note to end do::) module constructor
or destructor
downto (any) (*note downto::)
part of a `for' (*note for::) loop when counting downwards
else (any) (*note else::)
alternative part of an `if' (*note if::) statement, default case
label or part of the `or else' (*note or else::) operator
end (any) (*note end::)
end of a code block, end of a `case' (*note case::) statement, end
of a record or object declaration, part of a `to end do' (*note to
end do::) module destructor
export (EP, OP, BP, BD, GPC) (*note export::)
module interface export
exports (BP, BD, GPC) (*note exports::)
library export (not yet implemented)
external (EP, OP, UCSD, BP, BD, GPC) (*note external::)
declaration of external objects
file (any) (*note file::)
non-text file type declaration
for (any) (*note for::)
loop statement where the number of loops is known in advance
forward (UCSD, BP, BD, GPC) (*note forward::)
declaration of a routine whose definition follows below
function (any) (*note function::)
function declaration
goto (any) (*note goto::)
statement to jump to a `label' (*note label::)
if (any) (*note if::)
conditional statement
import (EP, OP, GPC) (*note import::)
module interface import
implementation (EP, OP, UCSD, BP, BD, GPC) (*note implementation::)
module or unit implementation part
in (any) (*note in::)
set membership test or part of a `for' (*note for::) loop when
iterating through sets
inherited (OP, BP, BD, GPC) (*note inherited::)
reference to methods of ancestor object types
inline (GPC) (*note inline::)
declaration of inline routines
interface (EP, OP, UCSD, BP, BD, GPC) (*note interface::)
module or unit interface part
interrupt (BP, BD) (*note interrupt::)
interrupt handler declaration (not yet implemented)
is (OP, BD, GPC) (*note is::)
object type membership test (not yet implemented)
label (any) (*note label::)
label declaration for a `goto' (*note goto::) statement
library (BP, BD, GPC) (*note library::)
library declaration (not yet implemented)
mod (any) (*note mod::)
integer remainder operator
module (EP, OP, GPC) (*note module::)
EP style or PXSC style (only partially implemented) modules
nil (any) (*note nil::)
reserved value for unassigned pointers
not (any) (*note not::)
Boolean or bitwise `not' operator
object (BP, BD, GPC) (*note object::)
BP style object declaration
of (any) (*note of::)
part of an array, set or typed file type declaration, a `case'
(*note case::) statement, a variant record type or a `type of'
(*note type of::) type inquiry
only (EP, OP, GPC) (*note only::)
import specification
operator (PXSC, GPC) (*note operator::)
operator declaration
or (any) (*note or::)
Boolean or bitwise `or' operator or part of the `or else' (*note
or else::) operator
or_else (EP, OP, GPC) (*note or_else::)
short-circuit Boolean `or' (*note or::) operator
otherwise (EP, OP, GPC) (*note otherwise::)
default case label
packed (any) (*note packed::)
declaration of packed record or array types, also packed ordinal
subranges
pow (EP, OP, GPC) (*note pow::)
exponentiation operator with integer exponent
private (BP, BD, GPC) (*note private::)
private object fields
procedure (any) (*note procedure::)
procedure declaration
program (any) (*note program::)
start of a Pascal program
property (OP, BD, GPC) (*note property::)
variable properties (not yet implemented)
protected (EP, OP, BD, GPC) (*note protected::)
read-only formal parameters and protected object fields
public (BP, BD, GPC) (*note public::)
public object fields
published (BP, BD, GPC) (*note published::)
published object fields
qualified (EP, OP, GPC) (*note qualified::)
import specification
record (any) (*note record::)
structured type declaration
repeat (any) (*note repeat::)
loop statement
resident (BP, BD) (*note resident::)
library export specification (not yet implemented)
restricted (EP, OP, GPC) (*note restricted::)
type specification
segment (UCSD) (*note segment::)
segment specification (not yet implemented)
set (any) (*note set::)
set type declaration
shl (BP, BD, GPC) (*note shl::)
bitwise left shift operator
shr (BP, BD, GPC) (*note shr::)
bitwise right shift operator
static (GPC) (*note static::)
static variable declaration
then (any) (*note then::)
part of an `if' (*note if::) statement or part of the `and then'
(*note and then::) operator
to (any) (*note to::)
part of a `for' (*note for::) loop when counting upwards or a `to
begin do' (*note to begin do::) or `to end do' (*note to end do::)
module constructor or destructor
type (any) (*note type::)
type declaration or part of a `type of' (*note type of::) type
inquiry
unit (UCSD, BP, BD, GPC) (*note unit::)
UCSD and BP style unit declaration
until (any) (*note until::)
end of a `repeat' (*note repeat::) statement
uses (UCSD, BP, BD, GPC) (*note uses::)
unit import
value (EP, OP, GPC) (*note value::)
variable initializer
var (any) (*note var::)
variable declaration or reference parameter declaration
view (OP, GPC) (*note view::)
object class view (not yet implemented)
virtual (OP, BP, BD, GPC) (*note virtual::)
virtual object method declaration
volatile (GPC) (*note volatile::)
volatile variable declaration
while (any) (*note while::)
loop statement
with (any) (*note with::)
automatic record or object field access
xor (BP, BD, GPC) (*note xor::)
Boolean or bitwise `exclusive or' operator
File: gpc.info, Node: Support, Next: To Do, Prev: Keywords, Up: Top
Where to get support for GNU Pascal; how to report bugs.
********************************************************
Here you can find information on where to find the most up-to-date
information about GPC, how you can get support (professional or
voluntary), how to use GPC's Test Suite, and how to report new bugs you
might encounter.
If you have problems with GNU Pascal, please read the relevant
sections of the GPC Manual. The most current version of the manual is
available at
`http://agnes.dida.physik.uni-essen.de/~gnu-pascal/gpc-doc.html' for
online browsing. You can also download the complete manual in HTML
format (tar.gz) (`gpc-html.tar.gz' on GPC's WWW home page). The manual
is also available in DVI format (gzipped) (`gpc.dvi.gz' on GPC's WWW
home page) and PostScript format (gzipped) (`gpc.ps.gz' on GPC's WWW
home page) for printing.
If the manual doesn't help you, here is what we recommend you to do:
*Note FAQ:: Check the GPC FAQ
* Menu:
* Mailing List:: Join the GPC Mailing List
* Mailing List Archives:: Look in the Mailing List Archives
* Newsgroups:: Ask in a newsgroup
* Professional Support:: Get individual support for GPC
* Compiler Crashes:: If the compiler crashes...
* Reporting Bugs:: Find out how to report GPC bugs
* Testing:: If you have GPC sources, learn how to run
the Test Suite to test your bugs reported
File: gpc.info, Node: Mailing List, Next: Mailing List Archives, Up: Support
The GPC Mailing List
====================
There is a mailing list devoted to GNU Pascal. You can write to the
mailing list, e.g. if you have problems installing GPC or if you found
a problem with GPC (please see *Note Reporting Bugs::). You can also
use it to discuss suggestions for improving GPC and, most welcome, to
offer your help or contribute code, documentation or other work. Mails
to the list should be in English.
To subscribe to the mailing list, send the command
subscribe gpc your@email.address
in the body of a mail to <majordomo@gnu.de> (*not* to
`gpc@gnu.de'!). The subject is ignored. (Please replace
`your@email.address' with your real email address.) For more info, send
a line `help' to <majordomo@gnu.de>.
You can send a message to the mailing list by sending email to the
list address <gpc@gnu.de> as if it were a person.
To leave the mailing list, send the command
unsubscribe gpc your@email.address
to <majordomo@gnu.de>.
There is also a (low-traffic) announce list, <gpc-announce@gnu.de>
that you can subscribe to stay up-to-date. To subscribe to the list,
write an email with
subscribe gpc-announce your@email.address
in the body to <majordomo@gnu.de>. If you like to announce a
contribution, a service or an event related to GPC, you are invited to
post to this list rather than `gpc@gnu.de', but please don't use the
announce list for questions or discussions. Please note that all mail
sent to the announce list is forwarded to the regular list, so you
won't have to subscribe to both lists if you don't want to miss
anything.